<?php if(!defined('IN_PISCES')){exit('Access Denied.');}?>
<div id="lb_login">
<div class="login_box">
<div class="login_form">
<input type="button" value="使用淘宝账号一键登录" class="lf-login-button" onclick="document.location='{url('User','Login')}'">
</div>
<div class="reg_or_weibo">
<p>
<h2>登录后你可以：</h2>
<ul>
<li>1. 收藏你喜欢的东东</li>
<li>2. 找到相同爱好的朋友</li>
<li>3. 获取好友推荐的东东</li>
<li>4. 更多...</li>
</ul>
</p>
</div>
</div>
</div>
<script language="javascript" type="text/javascript">
var ajax_login_fail = $('#ajax_login_fail');
var ajax_login_btn = $('#ajax_login_btn');
var loginUrl	= $('#hdLoginUrl').val();
ajax_login_btn.click(function(){
	ajax_login_fail.html('');
	var username	= $('#txtUsername').val();
	var password	= $('#txtPassword').val();
	var loginUrl	= $('#hdLoginUrl').val();
	if (!username){
		ajax_login_fail.html(LANG.user_name_require);
		return false;
	}
	if (!password){
		ajax_login_fail.html(LANG.user_pass_require);
		return false;
	}
	ajax_login_btn.attr("disabled",true);
	ajax_login_fail.html('正在登录...');
	
	$.ajax({
	    url: loginUrl,
	    type: 'POST',
	    data:{'username':username,'password':password,'rnum':Math.random()},
	    dataType: 'json',
	    success: function(res){
	    	ajax_login_btn.attr("disabled",false);
			if(res.code<=0){
				ajax_login_fail.html(LANG.login_error1);
			}else{
				USER_ID = res.data.user.id;
				$.weeboxs.close();
			}
		},
		error:function(res){
			ajax_login_btn.attr("disabled",false);
			ajax_login_fail.html(LANG.login_error);
		}
	});
});
</script>